/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * transfer.h : Most callbacks are put here.
 *
 * Copyright (C) 2008, 2009 Lingtao Pan
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, 
 * Boston, MA 02111-1307, USA.
 */

#ifndef GFTP2_TRANSFER_H
#define GFTP2_TRANSFER_H


/* I think we should keep this program as simple as possile. If people
 * like to connect to multiple sites, they can simply open multiple
 * instance of this program.
 *
 * So we only keep one instance of gftp_tranfer.  
 */


/* We define the folloing enum and tranfer_get_state() to avoid other
 * modules from peeking the state of tranfer directly.
 */
enum {
    TRANSFER_NONE = 0,
    TRANSFER_STOPPED,
    TRANSFER_FINISHED,
    TRANSFER_RUNNING
};

/* Before calling this function, other modules should first check if a
 * non-main thread is running by checking
 *        right_viewer->request->running
 * If a non-main thread is running, then there may be a transfer running.
 * Otherwise, the state of the transfer module can only be INIT or STOPPED
 */
int   transfer_get_state ();


/* Other modules should pack the parameters into a new
 * gftp_transfer `trans_new', and call the following functions.
 */
/* void* transfer_add_new   (gftp_transfer *trans_new); */
void* transfer_append    (gftp_transfer *trans_new);
void* transfer_start     ();
void* transfer_resume    ();
void* transfer_append_and_start (gftp_transfer *trans_new);

void  transfer_clear     ();


/* void* transfer_clear     (gftp_transfer *trans); */

gint update_downloads    (gpointer data);




#endif
